package com.arcadia.d2dmg;

import com.arcadia.d2.hero.Hero;
import com.arcadia.d2.heroes.HeroLibrary;
import com.arcadia.d2.item_attributes.Item;
import com.arcadia.d2.item_attributes.ItemLibrary;

public class Main {

	/*public static void main(String[] args){
		
		Item[] itemSlotOfAttacker = new Item[6];
		Item[] itemSlotOfDefender = new Item[6];		
		
		HeroLibrary heroLibrary = new HeroLibrary();
		ItemLibrary itemLibrary = new ItemLibrary();
		
		//Choose an Attacker, its level and its Items
		Hero attacker = selectHero("Attacker", heroLibrary.getHero());//heroLibrary.getHero()[heroID];
		int lvOfAttacker = Integer.parseInt(JOptionPane.showInputDialog(null, "Select a level for " + attacker.getName()));
		itemSlotOfAttacker[0] = selectItem("Item", itemLibrary.getItem());
		itemSlotOfAttacker[1] = selectItem("Item", itemLibrary.getItem());
		itemSlotOfAttacker[2] = selectItem("Item", itemLibrary.getItem());
		itemSlotOfAttacker[3] = selectItem("Item", itemLibrary.getItem());
		itemSlotOfAttacker[4] = selectItem("Item", itemLibrary.getItem());
		itemSlotOfAttacker[5] = selectItem("Item", itemLibrary.getItem());

		//Choose a Defender, its level and its Items
		Hero defender = selectHero("Defender", heroLibrary.getHero());//heroLibrary.getHero()[heroID];
		int lvOfDefender = Integer.parseInt(JOptionPane.showInputDialog(null, "Select a level for " + defender.getName()));
		itemSlotOfDefender[0] = selectItem("Item", itemLibrary.getItem());
		itemSlotOfDefender[1] = selectItem("Item", itemLibrary.getItem());
		itemSlotOfDefender[2] = selectItem("Item", itemLibrary.getItem());
		itemSlotOfDefender[3] = selectItem("Item", itemLibrary.getItem());
		itemSlotOfDefender[4] = selectItem("Item", itemLibrary.getItem());
		itemSlotOfDefender[5] = selectItem("Item", itemLibrary.getItem());	
		
		//How long to fight
		Double duration = Double.parseDouble(JOptionPane.showInputDialog(null, "How long do you need?"));
		
		Calculator calculator = new Calculator(attacker, lvOfAttacker, itemSlotOfAttacker, defender, lvOfDefender, itemSlotOfDefender, duration);
		
		String info = "Attacker: " + "\n" + attacker.getName() + "\n" + 
				  	  "Item: " + "\n" + 
				  	  (itemSlotOfAttacker[0]!=null?itemSlotOfAttacker[0].getName() + "\n":"") +
				  	  (itemSlotOfAttacker[1]!=null?itemSlotOfAttacker[1].getName() + "\n":"") +
					  (itemSlotOfAttacker[2]!=null?itemSlotOfAttacker[2].getName() + "\n":"") +
					  (itemSlotOfAttacker[3]!=null?itemSlotOfAttacker[3].getName() + "\n":"") +
				   	  (itemSlotOfAttacker[4]!=null?itemSlotOfAttacker[4].getName() + "\n":"") +
					  (itemSlotOfAttacker[5]!=null?itemSlotOfAttacker[5].getName() + "\n":"") +	
					  "\n" +
					  "Damage Calculated:\n" +
					  "AttackDamage: " + calculator.getAttackDamage() + "\n" +
					  (calculator.getMagicalDamage() > 0 ? "MagicalDamage: " + 
							  calculator.getMagicalDamage() + "\n" : "") +
					  (calculator.getPhysicalDamage() > 0 ? "PhysicalDamage: " + 
							  calculator.getPhysicalDamage() + "\n" : "") +	
					  (calculator.getPureDamage() > 0 ? "PureDamage: " + 
							  calculator.getPureDamage() + "\n" : "") +
					  (calculator.getCompositeDamage() > 0 ? "CompositeDamage: " + 
							  calculator.getCompositeDamage() + "\n" : "") +
					  (calculator.getHpRemoval() > 0 ? "HpRemoval: " + 
							  calculator.getHpRemoval() + "\n" : "") +
					  (calculator.getUniversalDamage() > 0 ? "UniversalDamage: " + 
							  calculator.getUniversalDamage() + "\n" : "") +	
					  "TotalDamage: " + calculator;
		
		JOptionPane.showMessageDialog(null, info);
		System.out.println (calculator.getAttackDamage());
		System.out.println (calculator.getMagicalDamage());
	}
	
	private static Hero selectHero(String type, Hero[] options)
    {
		int selection = JOptionPane.showOptionDialog
	                    (null, "Select A " + type, "DOTA2 CALCULATOR", JOptionPane.DEFAULT_OPTION,
	                    JOptionPane.QUESTION_MESSAGE, null, options, options[0]);	                       
	    return options[selection];
	}
	
	private static Item selectItem(String type, Item[] options)
    {
		int selection = JOptionPane.showOptionDialog
	                    (null, "Select An " + type, "DOTA2 CALCULATOR", JOptionPane.DEFAULT_OPTION,
	                    JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
	                       
	    return options[selection];
	}
	*/

}
